Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb+LibGfx: Use GPU backend for <canvas> #1532

Merged

Conversation

kalenikaliaksandr
Copy link
Member

This is implemented by using a GPU-accelerated surface for when
a GPU context is available.

A side effect of this change is that all canvas modifications have to be
performed through Gfx::Painter, and whenever its content has to be
accessed, we need to take a snapshot of the corresponding GPU surface.

A new DrawPaintingSurface display list command is introduced to allow
cheap blitting of canvas content without having to read GPU surface
content into RAM.This is a fix to the vcpkg package itself to fix some exported symbols.

This change depends on #1528 so I am marking it as a draft until it's merged.

@kalenikaliaksandr kalenikaliaksandr marked this pull request as draft September 25, 2024 19:55
This is required to share GPU context creation code between display list
player, which resides in LibWeb, and PainterSkia, which handles <canvas>
painting.
Adds a new class in LibGfx that represents GPU-accelerated surface and
will be used for both <canvas> and page rendering (display list player).
Since the Metal context is currently only used by LibGfx, it could be
moved there to avoid having Metal as a dependency for everything that
uses LibCore.
@kalenikaliaksandr
Copy link
Member Author

I rebased the branch, but linux CI fails with following error I can't reproduce locally on my linux computer. @ADKaster any chance you know what's going on here? could this be related to CI caches?

CMake Error at Build/vcpkg/scripts/buildsystems/vcpkg.cmake:639 (_add_library):
  Cannot find source file:

    VulkanContext.cpp
Call Stack (most recent call first):
  Meta/Lagom/CMakeLists.txt:217 (add_library)
  Meta/Lagom/CMakeLists.txt:302 (lagom_lib)
  Userland/Libraries/LibGfx/CMakeLists.txt:81 (serenity_lib)

@ADKaster
Copy link
Member

ADKaster commented Nov 6, 2024

@kalenikaliaksandr Looks like you git add'd the removal of VulkanContext.cpp from one lib, but forgot to add it in the new location. LibGfx/VulkanContext.cpp needs git add'd to the PR

@kalenikaliaksandr
Copy link
Member Author

@kalenikaliaksandr Looks like you git add'd the removal of VulkanContext.cpp from one lib, but forgot to add it in the new location. LibGfx/VulkanContext.cpp needs git add'd to the PR

oops, indeed!

@kalenikaliaksandr kalenikaliaksandr marked this pull request as ready for review November 7, 2024 02:21
Since the Vulkan context is currently only used by LibGfx, it could be
moved there to avoid having Vulkan as a dependency for everything that
uses LibCore.
This is implemented by using a GPU-accelerated surface for <canvas> when
a GPU context is available.

A side effect of this change is that all canvas modifications have to be
performed through Gfx::Painter, and whenever its content has to be
accessed, we need to take a snapshot of the corresponding GPU surface.

A new DrawPaintingSurface display list command is introduced to allow
cheap blitting of canvas content without having to read GPU surface
content into RAM.
@kalenikaliaksandr kalenikaliaksandr merged commit a7cbc7a into LadybirdBrowser:master Nov 7, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants